package com.lv.drawable

import android.graphics.Color
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.lv.drawable.drawable.State
import com.lv.drawable.drawable.selector
import com.lv.drawable.drawable.shape


class SecondActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)

        findViewById<TextView>(R.id.tv1).background = shape {
            corner(8f)
            solid(Color.RED)
        }

        findViewById<TextView>(R.id.tv2).background = selector {
            addState(State.PRESSED) {
                shape {
                    corner(8f)
                    solid(Color.GRAY)
                }
            }
            defState {
                shape {
                    corner(8f)
                    solid(Color.GREEN)
                }
            }
        }

        findViewById<TextView>(R.id.tv3).background = shape {
            corner(8f)
            stroke {
                width = 2
                color = Color.RED
            }
        }

        findViewById<TextView>(R.id.tv4).background = shape {
            corner(8f)
            solid(Color.LTGRAY)
            stroke {
                width = 2
                color = Color.RED
            }
        }
    }
}